﻿using System;
using System.Text.RegularExpressions;
using Autodesk.Revit.DB.Architecture;
using SectionSignAndFilled.StairsRoomPlanSign.ModelLayer;

namespace SectionSignAndFilled.StairsRoomPlanSign.ControlLayer
{
	public class ScissorStairDetctor : BaseStairsKindDetector
	{
		public ScissorStairDetctor()
		{
			this.m_thisStairsKind = StairsKindEnum.ScissorStair;
		}

		public override bool DetectThisStairs(SignUseStairsPacker inputStairPackers)
		{
			if (inputStairPackers.LstAllSameLevelStairsPacker.Count > 0 && inputStairPackers.LstAllSameLevelStairsPacker[0].LstStairs.Count == 2)
			{
				return true;
			}
			if (inputStairPackers.LstAllSameLevelStairsPacker.Count > 0 && inputStairPackers.LstAllSameLevelStairsPacker[0].LstStairs.Count == 1)
			{
				Stairs key = inputStairPackers.LstAllSameLevelStairsPacker[0].LstStairs[0].Key;
				StairsType stairsType = key.Document.GetElement(key.GetTypeId()) as StairsType;
				return stairsType != null && Regex.IsMatch(stairsType.Name, this.m_strKeyStairsTypeName);
			}
			return false;
		}

		private string m_strKeyStairsTypeName = "剪刀楼梯";
	}
}
